package com.shortchainsystem.user.controller;

import com.shortchainsystem.model.base.Result;
import com.shortchainsystem.model.domain.link.DO.LoginUserDO;
import com.shortchainsystem.user.service.UserService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
@Slf4j
public class LoginController {
    @Autowired
    private UserService userService;

    @PostMapping("/login")
    @ApiOperation("登录")
    public Result login(@RequestBody LoginUserDO loginUserDO) {
        return userService.login(loginUserDO);
    }

    @GetMapping("/loginout")
    @ApiOperation("退出")
    public Result loginout() {
        return userService.loginout();
    }
}